<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      div {
        width: 200px;
        height: 200px;
        background-color: pink;
      }
      p {
        width: 100px;
        height: 100px;
        background-color: skyblue;
      }
    </style>
  </head>
  <body>
    <div>
      <p></p>
    </div>
    <script>
      var p = document.querySelector('p')
      var div = document.querySelector('div')
      p.addEventListener(
        'click',
        function () {
          alert('p')
        },
        false
      )
      div.addEventListener(
        'click',
        function () {
          alert('div')
        },
        false
      )
      document.addEventListener(
        'click',
        function () {
          alert('html')
        },
        false
      )
    </script>
  </body>
</html>
